﻿@{
    ViewData["Title"] = "Home Page";
}
@using X.PagedList.Mvc.Core; @*import this so we get our HTML Helper*@
@using X.PagedList; @*import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@
@using X.PagedList.Mvc.Core.Fluent
@using X.PagedList.Web.Common
@using RemoteToolData.Data
@model IPagedList<DeviceInfo> 
<!-- import the included stylesheet for some (very basic) default styling -->
<link href="/css/PagedList.css" rel="stylesheet" type="text/css" />
<div class="text-center">
    <h1 class="display-4">欢迎使用RemoteTool</h1>
    @*<p>总共查询到 @Model.DeviceCount 条结果，包含项目 @Model.ProjectCount 个！ </p>*@
    <p>@ViewBag.OperaMsg</p>
   
</div>
<div class="row">
    @if (Model != null)
    {
        @foreach (var item in Model)
        {
            <div class="card" style="width: 18rem;margin:10px">
                <div class="card-body">
                    <h5 class="card-title">@item.ProjectName</h5>
                    <h6 class="card-subtitle mb-2 text-muted">@item.DeviceName</h6>
                    <div class="form-group">
                        <span class="form-row">连接次数：@item.ToDeskCount</span>
                        <span class="form-row">Todesk   ID：@item.ToDeskId</span>
                        <span class="form-row">Todesk 密码：@item.ToDeskPsw</span>
                    </div>

                    <div class="form-group">
                        <span class="form-row">连接次数：@item.OraySunCount</span>
                        <span class="form-row">向日葵   ID：@item.OraySunId</span>
                        <span class="form-row">向日葵 密码：@item.OraySunPsw</span>
                    </div>
                    <a asp-controller="Device" asp-action="Create" class="btn btn-primary">新增</a>
                    <a asp-controller="Device" asp-action="Delete" asp-route-guidCode=@item.GuidCode class="btn btn-primary">删除</a>
                    <a asp-controller="Device" asp-action="Modify" asp-route-guidCode=@item.GuidCode class="btn btn-primary">修改</a>
                    <a asp-controller="Device" asp-action="Details" asp-route-guidCode=@item.GuidCode class="btn btn-primary">查看</a>

                </div>
            </div>
        }
    }
    else
    {
        <p>当前没有找到该设备相关信息！</p>
    }
    
</div>

@*<nav aria-label="Page navigation example">
    <ul class="pagination justify-content-center">
        <li class="page-item disabled">
            <a class="page-link">上一页</a>
        </li>
        <li class="page-item"><a class="page-link" href="#">1</a></li>
        <li class="page-item"><a class="page-link" href="#">2</a></li>
        <li class="page-item"><a class="page-link" href="#">3</a></li>
        <li class="page-item">
            <a class="page-link" href="#">下一页</a>
        </li>
    </ul>
</nav>*@

<br />
Page @(Model?.PageCount < Model?.PageNumber ? 0 : Model?.PageNumber) of @Model?.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { page}))
@*@(Html.Pager(Model)
    .Url(page => Url.Action("Index", new { page }))
    .Build())*@

